package collection;

import java.util.Arrays;
import java.util.List;

public class ArrayToList {
    public static void main(String[] args) {

        String[] str={"多一眼","就会爆炸","近一点","快被融化","你干嘛"};
        System.out.println(Arrays.toString(str));
        List<String> list=Arrays.asList(str);
        System.out.println(list);
        //改变数组，集合也会改变
        str[4]="鸡你太美";
        System.out.println(Arrays.toString(str));
        System.out.println(list);
        //改变集合，数组也会改变
        list.set(4,"鸡你实在是太美");
        System.out.println(Arrays.toString(str));
        System.out.println(list);
        //给集合增删元素数组也要增删，但数组长度是恒定的，所以发生异常
        list.add("哇，真的是你啊");//UnsupportedOperationException:不支持的操作异常
    }
}
